package com.kodcu.web.book;

import com.kodcu.web.SkeletonPage;
import com.kodcu.web.book.content.JavaVeYazilimTasarimiPanel;
import com.kodcu.web.book.content.KitapMainPanel;
import com.kodcu.web.book.content.KitapPDFPanel;
import com.kodcu.web.menubar.Menu;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.ResourceModel;


public class BookMainPage extends SkeletonPage {

    public BookMainPage(PageParameters paramsOriginal) {
        Label title = (Label) this.get("title");
        title.setDefaultModel(new ResourceModel("title.kitap"));
        PageParameters params = new PageParameters();
        params.add("0", "java-kitap");
        Menu menu = new Menu("Menu", params);
        add(menu);


        String id = null; // go to default config
        try {
            id = paramsOriginal.getString("0");
            if (id == null) {
                id = "1000";
            }

        } catch (Exception ex) {
            id = "1000";
        }

        KitapMainPanel kitapMainPanel = new KitapMainPanel("MainSide", null);
        KitapPDFPanel kitapPDFPanel = new KitapPDFPanel("MainSide");
        JavaVeYazilimTasarimiPanel javaKitap = new JavaVeYazilimTasarimiPanel("MainSide");

        if (id.equalsIgnoreCase("java-kitap")) {
            //add(kitapMainPanel); // Kitap ana sayfa
            add(kitapPDFPanel);
        } else if (id.equalsIgnoreCase("java-kitap-pdf-indir")) {
            add(kitapPDFPanel); // Java Kitap Projesine Ait 8 adet döküman
        } else if (id.equalsIgnoreCase("java-kitap-slayt-kaynak-kod")) {
            add(javaKitap); // Kitabın slayt ve kaynak kodları
        } else {
            add(kitapPDFPanel); // Kitap ana sayfa
        }


    }


}
